import requests
import json
import sys  
from PyQt5.QtWidgets import QApplication, QDialog
from PyQt5.QtCore import pyqtSignal, Qt 
import Ui_warn
API_KEY = "SO8K3o2U9qm2WVqH6w7qOHrO"
SECRET_KEY = "Jjo4bypthpWi6j36Gp8IRaHexl7d19t2"

class warnwindow(QDialog):
    data_sent = pyqtSignal(int)
    def __init__(self, parent=None,zn=0):  
        super(warnwindow, self).__init__(parent)  
        self.ui =Ui_warn.Ui_Dialog() 
        
        self.ui.setupUi(self)
        
        self.ui.pushButton.clicked.connect(self.warn_ok)
        self.ui.pushButton_2.clicked.connect(self.warn_quit)
        
        self.ui.pushButton.setText("确认")
        self.ui.pushButton_2.setText("取消")
        
        self.nanaly=0

        labeltext='当前总文本量仅有'+str(zn)+'字\n最好文本量为多于100字'+"\n请问是否仍要分析"
        self.ui.label.setText(labeltext)
    
    def warn_quit(self):
        self.close()
    
    def warn_ok(self):
        self.data_sent.emit(1)
        self.close()
    
    def warn_setn(self):
        nanaly = 0

 

if __name__ == '__main__':
    app = QApplication(sys.argv)  
    mainWin = warnwindow()  
    mainWin.show() 
    app.exec_()
    print(mainWin.nanaly)
    sys.exit()